package cuiyt.juc.bq.priorityblockingqueue;

import java.util.ArrayList;
import java.util.concurrent.PriorityBlockingQueue;

/**
 * @author cyt
 * @describe
 * @create 2020-12-24 17:04
 */
public class PriorityBlockingQueueTest {
    // todo 使用堆
    public static void main(String[] args) throws InterruptedException {
        PriorityBlockingQueue<Integer> queue = new PriorityBlockingQueue();
        queue.add(39);
        queue.add(32);
        queue.add(35);
        queue.add(31);
        queue.contains(3);
        queue.remove();
        queue.remove(3);
        queue.take();
        queue.put(3);
        ArrayList<Integer> list = new ArrayList<>();
        queue.peek();
       //  int drainTo = queue.drainTo(list);
       //  System.out.println(drainTo);
        list.forEach(System.out::println);
//        System.out.println(queue.poll());
//        System.out.println(queue.poll());
//        System.out.println(queue.poll());
//        System.out.println(queue.poll());
        queue.clear();
    }
}
